/**
 * 
 */
package com.gkwave.action.service;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.gkwave.module.bean.MessageBean;
import com.gkwave.module.dao.TradeProductDAO;

/**
 * @author Administrator
 *
 */
public class TradeSellProductService extends BaseService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1753166184819049367L;

	/**
	 * 
	 */
	public TradeSellProductService() {
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see com.gkwave.action.service.BaseService#procesRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public void procesRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String nmTradeProduct = request.getParameter("nmTradeProduct");
		String txtTradeProduct = request.getParameter("txtTradeProduct");
		String nrTradeProductPrice = request.getParameter("nrTradeProductPrice");
		String dtTradeStart = request.getParameter("dtTradeStart");
		String idUser = request.getParameter("idUser");
		String nrMaxHour = request.getParameter("nrMaxHour");
		TradeProductDAO dao = null;
		if(nrMaxHour!=null && nmTradeProduct!=null && txtTradeProduct!=null && nrTradeProductPrice!=null && dtTradeStart!=null && idUser!=null){
			dao = new TradeProductDAO();
			MessageBean bean = dao.sellTradeProduct(nmTradeProduct, txtTradeProduct, nrTradeProductPrice, dtTradeStart, idUser,nrMaxHour);
			xmlResponse = bean.marsel(bean);
		} else{
			xmlResponse = new MessageBean().marsel(new MessageBean("Error","empty input!!!"));
		}
		out = response.getWriter();
		System.out.println(xmlResponse);
		out.println(xmlResponse);
	}

}
